﻿using AssetManageSystem.Model.DictionaryManage;
using System;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;

namespace AssetManageSystem.Model.OrgManage
{
    public enum UserSexEnum
    {
        [Display(Name = "男")]
        Man = 0,

        [Display(Name = "女")]
        Wman = 1,
    }

    public class User : PersistPoco
    {
        /// <summary>
        /// 姓名
        /// </summary>
        [Display(Name = "姓名")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [StringLength(10, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string UserName { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        [Display(Name = "性别")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public UserSexEnum UserSex { get; set; }
        /// <summary>
        /// 生日
        /// </summary>
        [Display(Name = "生日")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? UserBirthday { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        [Display(Name = "地址")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string UserAddress { get; set; }
        /// <summary>
        /// 电话号码
        /// </summary>
        [Display(Name = "电话号码")]
        [StringLength(30, ErrorMessage = "Validate.{0}stringmax{1}")]
        [RegularExpression("^[1][3-9]\\d{9}$", ErrorMessage = "Validate.{0}formaterror")]
        public string UserPhone { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        [Display(Name = "邮箱")]
        [RegularExpression("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", ErrorMessage = "Validate.{0}formaterror")]
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string UserEmail { get; set; }
        /// <summary>
        /// 部门
        /// </summary>
        [Display(Name = "部门")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public Guid? UserDepId { get; set; }
        [Display(Name = "部门")]
        public Department UserDep { get; set; }
    }
}
